function twoSum(nums, target) {
    const diffs = {}  // es5 没有hashMap o(1)复杂度
    const len = nums.length
    for(let i=0;i<len;i++){
        const diff = target -nums[i]
        if(diffs[diff]){
            return [diffs[diff],i]
        }
        else{
            diffs[nums[i]] = i
        }
    }
}